
--[[

    slimui - Copyright (c) 2011 atom0s, All rights reserved.

    See Copyright notice in slimui.lua
    
]]--

class 'Memo: Edit' { ... };

----------------------------------------------------------------------------------
-- func: Memo.__init__
-- desc: Constructor called when this object is first created.
----------------------------------------------------------------------------------
function Memo.__init__( self )
    Edit.__init__( self );
end

----------------------------------------------------------------------------------
-- func: Memo:Create
-- desc: Creates a new memo object.
----------------------------------------------------------------------------------
function Memo:Create( parent )
    if parent == nil or parent._object == nil then
        slimui:err( 'Memo:Create - parent must be set to create a control!' );
    end
    
    self._object = createMemo( parent._object );
    
    if self._object == nil then
        slimui:err( 'Memo:Create - failed to initialize a new object.' );
    end
    
    return self;
end

----------------------------------------------------------------------------------
-- func: Memo:Append
-- desc: Appends the given line to this memo.
----------------------------------------------------------------------------------
function Memo:Append( str )
    memo_append( self._object, str );
end

----------------------------------------------------------------------------------
-- func: Memo:GetLines
-- desc: Returns the current lines of this memo.
----------------------------------------------------------------------------------
function Memo:GetLines( )
    return memo_getLines( self._object )
end

----------------------------------------------------------------------------------
-- func: Memo:GetWordWrap
-- desc: Returns the word wrap property of this memo.
----------------------------------------------------------------------------------
function Memo:GetWordWrap( )
    return memo_getWordWrap( self._object );
end

----------------------------------------------------------------------------------
-- func: Memo:SetWordWrap
-- desc: Sets the word wrap property of this memo.
----------------------------------------------------------------------------------
function Memo:SetWordWrap( wrap )
    memo_setWordWrap( self._object, wrap );
end

----------------------------------------------------------------------------------
-- func: Memo:GetWantTabs
-- desc: Returns the want tabs property of this memo.
----------------------------------------------------------------------------------
function Memo:GetWantTabs( )
    return memo_getWantTabs( self._object );
end

----------------------------------------------------------------------------------
-- func: Memo:SetWantTabs
-- desc: Sets the want tabs property of this memo.
----------------------------------------------------------------------------------
function Memo:SetWantTabs( tabs )
    memo_setWantTabs( self._object, tabs );
end

----------------------------------------------------------------------------------
-- func: Memo:GetWantReturns
-- desc: Returns the want returns property of this memo.
----------------------------------------------------------------------------------
function Memo:GetWantReturns( )
    return memo_getWantReturns( self._object );
end

----------------------------------------------------------------------------------
-- func: Memo:SetWantReturns
-- desc: Sets the want returns property of this memo.
----------------------------------------------------------------------------------
function Memo:SetWantReturns( rets )
    memo_setWantReturns( self._object, rets );
end

----------------------------------------------------------------------------------
-- func: Memo:GetScrollbars
-- desc: Returns the scrollbar property of this memo.
----------------------------------------------------------------------------------
function Memo:GetScrollbars( )
    return memo_getScrollbars( self._object );
end

----------------------------------------------------------------------------------
-- func: Memo:SetScrollbars
-- desc: Sets the scrollbar property of this memo.
----------------------------------------------------------------------------------
function Memo:SetScrollbars( bars )
    memo_setScrollbars( self._object, bars );
end



--[[ Debug information. ]]--------------------------------------------------------
if ( slimui:isdebug() == true ) then
    slimui:msg( '(Control) memo.lua successfully loaded.' );
end